﻿
using CefSharp;
using CefSharp.WinForms;
using DevTool.Command;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DevTool.Contraner
{
    public partial class ChatGpt : UserControl
    {
        private ChromiumWebBrowser Browser;
        public ChatGpt()
        {
            var url = ConfigHelper.AppSetting("OpenAiUrl");
            if (!string.IsNullOrWhiteSpace(url))
            {
                Browser = new ChromiumWebBrowser(url);
            }
            else
            {
                MessageBox.Show("AI地址不能为空！","提示");
            }
                
         
            this.Browser.JavascriptObjectRepository.Settings.LegacyBindingEnabled = true; 
        
            InitializeComponent();
        }

        private void ChatGpt_Load(object sender, EventArgs e)
        {
            Browser.Dock = DockStyle.Fill;         
            this.panel_body.Controls.Add(Browser);        
           
        }
    }
}
